#include <opencv2/opencv.hpp>
#include <vector>
#include <iostream>
#include<string>
#include "utils.h"

void rtmpTest() {
	std::string source = "https://gcalic.v.myalicdn.com/gc/wgw05_1/index.m3u8?contentid=2820180516001";
	//std::string source = "rtmp://liteavapp.qcloud.com/live/liteavdemoplayerstreamid";
	//string source = "test.flv";
	cv::VideoCapture inputVideo(source, cv::CAP_FFMPEG);              // Open input

	if (!inputVideo.isOpened())
	{
		std::cout << "Could not open the input video: " << source << std::endl;
		return;
	}

	int cnt = 0;

	while (1)
	{
		cv::Mat frame;

		// Capture frame-by-frame 
		inputVideo >> frame;
		cnt++;
		std::cout << occlusionDetect(frame) << std::endl;
		//std::cout << blockDetect(frame) << std::endl;

		// If the frame is empty, break immediately
		if (frame.empty())
			break;
		cv::imshow("Frame", frame);

		// Press  ESC on keyboard to  exit
		char c = (char)cv::waitKey(1);
		if (c == 27)
			break;
	}

	inputVideo.release();

}
void main() {
	rtmpTest();
}
